
import Phaser from "phaser";

const _knapGrid = Symbol('_knapGrid');
const _error = Symbol('_error');
export default class UtilsGrid {
    constructor(_options, _data, _that) {
        if (!_options) return this[_error]('no options?');
        if (!_data) return this[_error]('no data?');
        this.options = _options;
        this.data = _data;
        this[_knapGrid](_that);
    }

    [_knapGrid]() {
        console.log(this.data)
        Phaser.Actions.GridAlign(this.data.getChildren(), {
            width: this.options.w,
            height: this.options.h,
            cellWidth: this.options.cw,
            cellHeight: this.options.ch,
            x: this.options.x,
            y: this.options.y
        });
    }

    [_error](err) {
        throw err;
    }
}